<!--顶部导航组件-->
<template>
  <div class="container">
    <p class="menu_switch" @click="menuSwitch()"></p>
    <!--面包屑-->
    <ul class="bread-parent">
      <li class="bread-item" v-for="(item,index) in $store.state.currentLocation">
        <router-link :to="item.path">{{item.name}}</router-link>
        <span v-show="!(index===$store.state.currentLocation.length-1)">/</span>
      </li>
    </ul>
    <!--退出按钮-->
    <p class="logout-btn" @click="requestLogout()">退出</p>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        "test": ""
      }
    },
    components: {},
    activated() {

    },
    deactivated() {
      this.$destroy(true);
    },
    beforeRouteLeave(to, from, next) {
      next();
    },
    methods: {
      menuSwitch() {
        this.$emit("changeMenuStatus");
      },

      requestLogout() {
        let that = this;
        that.$utils.removeCookie(that.$keys.USER_ID);
        that.$utils.removeCookie(that.$keys.USER_KEY);
        that.$utils.removeCookie(that.$keys.AGENT_ID);
        that.$router.replace("/login");
      }
    }
  }
</script>

<style lang="scss" scoped="" type="text/scss" src="../../assets/style/c-nav-top.scss">
</style>

